<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title><?php echo ($data["post_title"]); ?></title>
    <link rel="stylesheet" href="//res.wx.qq.com/open/libs/weui/1.1.3/weui.min.css"/>
    <style>
      .desc {
        color: #999;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
        padding-bottom: 4px;
        font-size: 14px;
      }
      .center {
        text-align: center;
      }
      .img {
        max-width: 100%;
        height: auto;
      }
      .video {
        width: 100%;
        height: auto;
      }
      .icon-box {
        text-align: center;
        padding: 20px;
      }
      .iframe {
        border: none;
        width: 100%;
      }
    </style>
  </head>
  <body>
    <?php if(!empty($data["post_id"])): ?><article class="weui-article">
      <h1><?php echo ($data["post_title"]); ?></h1>
      <p class="desc">发布时间：<?php echo ($data["post_created_time"]); ?></p>
      <section>
        <h2 class="title"><?php echo ($data["post_subtitle"]); ?></h2>
        <section>
          <p class="center">
            <?php if(($data["post_type"]) == "1"): ?><video class="video" src="<?php echo ($data["post_file_url_full"]); ?>" controls /><?php endif; ?>
            <?php if(($data["post_type"]) == "2"): if(!empty($data["post_file_url_html"])): ?><iframe class="iframe" src="<?php echo ($data["post_file_url_html"]); ?>" onload="setIframeHeight(this)" ></iframe>
              <?php else: ?>
              <div class="icon-box">
                <i class="weui-icon-warn weui-icon_msg-primary"></i>
                <div class="icon-box__ctn">
                  <h3 class="icon-box__title">文件内容解析失败</h3>
                </div>
              </div><?php endif; endif; ?>
            <?php if(($data["post_type"]) == "3"): ?><img class="img" src="<?php echo ($data["post_file_url_full"]); ?>" alt="文章图片"><?php endif; ?>
          </p>
          <h3><b><?php echo ($data["post_body_title"]); ?></b></h3>
          <p><?php echo ($data["post_body_desc"]); ?></p>
        </section>
      </section>
    </article>
    <?php else: ?>
    <div class="icon-box">
      <i class="weui-icon-warn weui-icon_msg"></i>
      <div class="icon-box__ctn">
        <h3 class="icon-box__title">内容不存在</h3>
        <p class="icon-box__desc">您查看的文章不存在</p>
      </div>
    </div><?php endif; ?>
    <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
        <div class="weui-media-box__hd">
            <img class="weui-media-box__thumb" src="" alt="">
        </div>
        <div class="weui-media-box__bd">
            <h4 class="weui-media-box__title">标题一</h4>
            <p class="weui-media-box__desc">由各种物质组成的巨型球状天体，叫做星球。星球有一定的形状，有自己的运行轨道。</p>
        </div>
    </a>
  </body>
  <script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  <script>
    function setIframeHeight(iframe) {
      if (iframe) {
        var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
        if (iframeWin.document.body) {
          iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
        }
      }
    };
    // wx.config({
    //     debug: true,
    //     appId: <?php echo ($appId); ?>, // 必填，公众号的唯一标识
    //     timestamp: <?php echo ($timestamp); ?>, // 必填，生成签名的时间戳
    //     nonceStr: <?php echo ($nonceStr); ?>, // 必填，生成签名的随机串
    //     signature: <?php echo ($signature); ?>,// 必填，签名
    //     jsApiList: [] // 必填，需要使用的JS接口列表
    // });
  </script>
</html>